package com.jinxin.platform.cdinfogo.controller;

import com.alibaba.fastjson.JSON;
import com.jinxin.platform.base.common.pojo.JsonResult;
import com.jinxin.platform.cdinfogo.pojo.domain.CdinfogoContent;
import com.jinxin.platform.cdinfogo.service.CdinfogoContentService;
import com.jinxin.platform.cdinfogo.service.CdinfogoDcService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (CdinfogoContent)表控制层
 *
 * @author zhangpeng
 * @since 2021-06-28 17:23:22
 */
@RestController
@RequestMapping("cdinfogoContent")
public class CdinfogoContentController {
    /**
     * 服务对象
     */
    @Resource
    private CdinfogoContentService cdinfogoContentService;
    @Resource
    private CdinfogoDcService cdinfogoDcService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public JsonResult selectOne(String id) {
        return this.cdinfogoContentService.queryById(id);
    }

    @PostMapping("insert")
    public JsonResult insert(String list,String ids){

        List<CdinfogoContent> cdinfogoContents = JSON.parseArray(list, CdinfogoContent.class);
        List<String> strings = JSON.parseArray(ids, String.class);

        return cdinfogoContentService.insertAll(cdinfogoContents,strings);

    }

}